var profileApp = {
	_init : function() {
		// $('#submit_btn').on('click', profileApp._profile);
		$('form').on('keypress', profileApp._enterSubmit)
	},
	_profile : function(e) {
		if ($('#password_input').val() == '') {
			$('.form-action').before('<div class="control-group error"><label>密码错误!</label></div>');
			e.preventDefault();
			return false;
		}
	},
	
	_enterSubmit : function(e) {
		var theEvent = window.event || e;
		var code = theEvent.keyCode || theEvent.which;
		if (code == 13) {
			$("#submit_btn").submit();
		}
	}
};

$(function() {
	profileApp._init();
	Placeholders.init(true);
	$("#profile_form").validate({
		rules: {
			name: {
				required: true
			},
			sex: {
				required: true
			},
			county : {
				required: true
			}
		},
		messages : {
			name : {
				required : "请填写您的姓名。"
			},
			sex : {
				required : "请填写您的性别。"
			},
			county : {
				required: "请选择您的所在地区。"
			}
		}
	});
});